// pages/video_detail/video_detail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    video_src2:'',
    video_hidden:true,
    video_hiddens:false,
    video_hiddens2:false,
    video_detail:[],
    isShowBtn: false,
    ur:'',
    down:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    this.setData({
      tel: wx.getStorageSync('phoneNumber')
    })
    var that = this;
    var ids = options.id;
    var ajy = wx.getStorageSync('ajy')
    if (ajy==3) {
      this.setData({
        isShowBtn:true
      })
    } else {
      this.setData({
        isShowBtn: false
      })
    }
    that.setData({ huodongid: ids })
    that.videoData(ids)
  },
  videoData:function(ids) {
    console.log(ids)
    var that = this;
    wx.showLoading({
      title: '加载中',
    })
    wx.request({
      url: "https://miniapp.odeman.com/summercamp/vedio_detail.php?itemid=" + ids,
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        wx.hideLoading()
        console.log(res)
        that.setData({
          video_detail: res.data,
          video_src2: res.data.video,
          up: res.data.up,
          down: res.data.down
        })
      }
    })
  },
  up:function(e){
    console.log(e)
    if (this.data.up==null) {
      wx.showModal({
        title: '',
        content: '主人，已经没有上一期了哟'
      })
    }
    else {
      this.videoData(this.data.up)
    }

  },
  down: function (e) {
    if (this.data.down == null) {
      wx.showModal({
        title: '',
        content: '主人，已经没有下一期了哟'
      })
    }
    else {
      this.videoData(this.data.down)
    }


  
  }

})